cmake_minimum_required(VERSION 3.16)

project(test_udp_receiver VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找 Qt6 的核心模块
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Network)

# 项目源文件
set(PROJECT_SOURCES
    main.cpp
    mainwindow.cpp
    mainwindow.h
    mainwindow.ui
    udpsender.cpp
    udpsender.h
    protocol.h
)

# 添加可执行文件
qt_add_executable(udp_sender_main
    MANUAL_FINALIZATION
    ${PROJECT_SOURCES}
    test.ui
)

# 链接 Qt6 库和额外的系统库
target_link_libraries(udp_sender_main PRIVATE Qt6::Core Qt6::Widgets Qt6::Network)

# JSON支持通过Qt内置模块提供，无需额外配置
message(STATUS "JSON support enabled via Qt built-in modules")

# 如果使用 Qt6，必须调用 finalize
qt_finalize_executable(udp_sender_main)
